x86/shadow: Avoid overflowing sh_ctxt->seg_reg[]
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 1 Jul 2016 00:02:04 +0000 (01:02 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 8 Sep 2016 12:16:26 +0000 (14:16 +0200)
commita9f3b3bad17d91e2067fc00d51b0302349570d08
treef16c4f137bb67ee5ca1109a22b357b03793aef6a
parente9575f980df81aeb0e5b6139f485fd6f7bb7f5b6
x86/shadow: Avoid overflowing sh_ctxt->seg_reg[]

hvm_get_seg_reg() does not perform a range check on its input segment, calls
hvm_get_segment_register() and writes straight into sh_ctxt->seg_reg[].

x86_seg_none is outside the bounds of sh_ctxt->seg_reg[], and will hit a BUG()
in {vmx,svm}_get_segment_register().

HVM guests running with shadow paging can end up performing a virtual to
linear translation with x86_seg_none.  This is used for addresses which are
already linear.  However, none of this is a legitimate pagetable update, so
fail the emulation in such a case.

This is XSA-187 / CVE-2016-7094.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/shadow/common.c